package com.zc.im.mapper.im.group;

import com.zc.im.model.im.group.ZcImDirectoryGroup;
import com.zc.im.model.im.group.ZcImDirectoryGroupExample;
import com.zc.im.model.im.group.ZcImDirectoryGroupKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface ZcImDirectoryGroupMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory_group
     *
     * @mbggenerated
     */
    int countByExample(ZcImDirectoryGroupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory_group
     *
     * @mbggenerated
     */
    int deleteByExample(ZcImDirectoryGroupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory_group
     *
     * @mbggenerated
     */
    @Delete({
        "delete from zc_im_directory_group",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(ZcImDirectoryGroupKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory_group
     *
     * @mbggenerated
     */
    @Insert({
        "insert into zc_im_directory_group (id, parent_group_id, ",
        "user_id, group_name, ",
        "support_modify_status, group_type, ",
        "group_people_num, group_sort, ",
        "company_id, created_time, ",
        "updated_time, status)",
        "values (#{id,jdbcType=INTEGER}, #{parentGroupId,jdbcType=INTEGER}, ",
        "#{userId,jdbcType=INTEGER}, #{groupName,jdbcType=VARCHAR}, ",
        "#{supportModifyStatus,jdbcType=VARCHAR}, #{groupType,jdbcType=VARCHAR}, ",
        "#{groupPeopleNum,jdbcType=INTEGER}, #{groupSort,jdbcType=INTEGER}, ",
        "#{companyId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, ",
        "#{updatedTime,jdbcType=TIMESTAMP}, #{status,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=true, resultType=Integer.class)
    int insert(ZcImDirectoryGroup record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory_group
     *
     * @mbggenerated
     */
    int insertSelective(ZcImDirectoryGroup record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory_group
     *
     * @mbggenerated
     */
    List<ZcImDirectoryGroup> selectByExample(ZcImDirectoryGroupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory_group
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "id, parent_group_id, user_id, group_name, support_modify_status, group_type, ",
        "group_people_num, group_sort, company_id, created_time, updated_time, status",
        "from zc_im_directory_group",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    ZcImDirectoryGroup selectByPrimaryKey(ZcImDirectoryGroupKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory_group
     *
     * @mbggenerated
     */
    int updateByExampleSelective(@Param("record") ZcImDirectoryGroup record, @Param("example") ZcImDirectoryGroupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory_group
     *
     * @mbggenerated
     */
    int updateByExample(@Param("record") ZcImDirectoryGroup record, @Param("example") ZcImDirectoryGroupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory_group
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(ZcImDirectoryGroup record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_directory_group
     *
     * @mbggenerated
     */
    @Update({
        "update zc_im_directory_group",
        "set parent_group_id = #{parentGroupId,jdbcType=INTEGER},",
          "user_id = #{userId,jdbcType=INTEGER},",
          "group_name = #{groupName,jdbcType=VARCHAR},",
          "support_modify_status = #{supportModifyStatus,jdbcType=VARCHAR},",
          "group_type = #{groupType,jdbcType=VARCHAR},",
          "group_people_num = #{groupPeopleNum,jdbcType=INTEGER},",
          "group_sort = #{groupSort,jdbcType=INTEGER},",
          "company_id = #{companyId,jdbcType=INTEGER},",
          "created_time = #{createdTime,jdbcType=TIMESTAMP},",
          "updated_time = #{updatedTime,jdbcType=TIMESTAMP},",
          "status = #{status,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ZcImDirectoryGroup record);
}